﻿using System;
using System.Collections.Generic;
using System.Text;

using MapCenterSystem.DataInfo;
using MapCenterSystem.DataAccess;

namespace MapCenterSytem.Process
{
    public class PlaceTypeEx: PlaceType
    {
        public static PlaceTypeInfo GetPlaceTypeByDescription(string des)
        {
            PlaceTypeServiceEx placeTypeService = new PlaceTypeServiceEx();
            return placeTypeService.GetPlaceTypeByDescription(des);
        }

        public static int AddPlaceType(PlaceTypeInfo type)
        {
            PlaceTypeServiceEx placeTypeService = new PlaceTypeServiceEx();
            return placeTypeService.AddPlaceType(type);
        }

        public static bool UpdatePlaceType(PlaceTypeInfo type)
        {
            PlaceTypeServiceEx placeTypeService = new PlaceTypeServiceEx();
            return placeTypeService.UpdatePlaceType(type);
        }

        public static bool UpdatePlaceTypePicture(PlaceTypeInfo type)
        {
            PlaceTypeServiceEx placeTypeService = new PlaceTypeServiceEx();
            return placeTypeService.UpdatePlaceTypePicture(type);
        }

        public static bool DeletePlaceType(int id)
        {
            PlaceServiceEx placeService = new PlaceServiceEx();
            IList<PlaceInfo> lstPlace = placeService.GetPlaceByPlaceType(id);
            if (lstPlace.Count != 0)
                return false;
            PlaceTypeServiceEx placeTypeService = new PlaceTypeServiceEx();
            return placeTypeService.DeletePlaceType(id);
        }

        public static IList<PlaceTypeInfo> GetListPlaceType()
        {
            PlaceTypeServiceEx placeTypeService = new PlaceTypeServiceEx();
            return placeTypeService.GetListPlaceType();
        }
    }
}
